import { EChartsOption } from 'echarts'

export const pieRegionOptions: EChartsOption = {
  tooltip: {
    trigger: 'item',
    formatter: '{a} <br/>{b}: {c} ({d}%)'
  },
  grid: {
    left: '10%', // 根据需要调整与容器左侧的距离
    right: '30%', // 留出空间给右侧的legend，这个值应该与legend的width和right属性相协调
    top: '10%',
    bottom: '10%',
    containLabel: true, // 确保标签不会被裁剪
  },
  legend: {
    type: 'scroll',
    orient: 'vertical',
    right: 20,
    top: '10%',
    itemGap: 10
  },
  series: [
    {
      name: '项目风险',
      type: 'pie',
      center: ['24%', '55%'],
      radius: ['40%', '60%'],
      avoidLabelOverlap: false,
      itemStyle: {
        borderRadius: 10,
        borderColor: '#fff',
        borderWidth: 0,
        color: function (colors) {
          const colorList = ['#2478F2', '#58A55C', '#68BBC4']
          return colorList[colors.dataIndex]
        }
      },
      label: {
        show: false,
        position: 'center'
      },
      emphasis: {
        label: {
          formatter: '{c}',
          show: true,
          fontSize: 20,
          fontWeight: 'bold'
        },
        itemStyle: {
          shadowBlur: 10,
          shadowOffsetX: 0,
          shadowColor: 'rgba(0, 0, 0, 0.5)'
        }
      },
      labelLine: {
        show: false
      },
      data: [
        { value: 0, name: '未及时交底风险' },
        { value: 0, name: '未及时团队组建风险' },
        { value: 0, name: '未及时交付风险' }
      ]
    }
  ]
}

export const barTimeOptions: EChartsOption = {
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'cross',
      crossStyle: {
        color: '#999'
      }
    }
  },
  grid: {
    height: '90%',
    top: 10,
    left: 0,
    containLabel: true
  },
  xAxis: [
    {
      type: 'category',
      data: ['2020', '2021', '2022', '2023', '2024'],
      show: false
    }
  ],
  yAxis: [
    {
      type: 'value',
      show: false
    }
  ],
  series: [
    {
      type: 'line',
      smooth: true,
      areaStyle: {
        color: 'rgba(100,149,237, 0.3)'
      },
      tooltip: {
        valueFormatter: function (value) {
          return value + '  万元'
        }
      },
      data: [0, 0, 0, 0, 0]
    }
  ]
}